package com.liushunqiu.realtor;

import com.liushunqiu.realtor.annotation.*;
import io.vertx.ext.web.RoutingContext;

import java.util.Objects;

@Controller
@BaseURL(base = "/test")
public class TestController {
    @GET(path = "/getRuntimeException")
    public TestGETDTO getRuntimeException(TestGETDTO testGETDTO){
        throw new RuntimeException("测试");
    }
    @GET(path = "/sayWithDTO")
    public TestGETDTO sayWithNo(TestGETDTO testGETDTO){
        return testGETDTO;
    }

    @GET(path = "/sayWithNo")
    public String sayWithNo(){
        return "222";
    }
  @GET(path = "/say")
  public String say(@Param(value = "test")String test){
    return test;
  }
  @POST(path = "/testPost")
  public TestPostDTO testPost(@RequestBody TestPostDTO testPostDTO){
    System.out.println(testPostDTO.getInnert());
    if (Objects.equals(testPostDTO.getTest(),"1")){
      testPostDTO.setTest("2");
      testPostDTO.setBody("我爱你");
    }
    return testPostDTO;
  }

  @POST(path = "/testPost1")
  public TestPostDTO testPost1(){
    return null;
  }
}
